package com.sss.hloster03;

public class Test2Array2 {

	public static void main(String[] args) {
		test01();
	}

	private static void test01() {
		int i, j;
		int[][] a = new int[10][10];
		a[0][0] = 1;//给第一行数组元素赋值
		for (i = 1; i < 10; i++) {//给二维数组元素赋值
			a[i][0] = 1;//给第一列元素赋值
			a[i][i] = 1;//给对角线元素赋值
			for (j = 1; j < i; j++) {
				a[i][j] = a[i - 1][j] + a[i - 1][j - 1];//按杨辉三角规则赋值
			}
		}
		for (i = 0; i < 10; i++) {//打印杨辉三角
			for (j = 0; j <= i; j++) //控制每行打印的个数
				System.out.print(" " + a[i][j] + " " );
				System.out.println();
			
		}
	}
}
